import request from '@/plugins/request';

export function UserLogin (data) {
    return request({
        //url: `/Authentication/api/user/login?account=${data.account}&password=${data.password}`,
        url: `/api/digitalcanteen/user/login?loginid=${data.account}&password=${data.password}`,        
        method: 'get'
    });
}

export function GetUserInfo(){
    return request({
        url:'/api/digitalcanteen/user/useinfo',
        method:'get'
    });
}

///查询单条
export function GetData (id) {
    return request({
        url: `/api/digitalcanteen/user/${id}`,        
        method: 'get'
    });
}
///查询多条
export function GetList (param) {
    return request({
        url: `/api/digitalcanteen/user?pageIndex=${param.pageIndex}&pageSize=${param.pageSize}&sortType=${param.sortType}&sortKey=${param.sortKey}`,
        method: 'get'
    });
}
//新增、更新（data.id为空或没有id参数时为新增）
export function SaveData (data) {
    if(data.hasOwnProperty("id")){
        if(!data.id) delete data.id;
    }
    return request({
        url: `/api/digitalcanteen/user/`,    
        data:data,     
        method: 'post'
    });
}
//删除多条，id间用“,”分隔
export function Delete (idList) {
    return request({
        url: `/api/digitalcanteen/user?idList=${idList}`,        
        method: 'delete'
    });
}

//查询账号是否存在（true：存在   false：不存在）
export function AccountExists (account) {
    return request({
        url: `/api/digitalcanteen/user/accountexists?account=${account}`,        
        method: 'get'
    });
}

//查询数据源数据
export function orgDataSource () {
    return request({
        url: `/api/digitalcanteen/user/orgdatasource`,        
        method: 'get'
    });
}